home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Sound / Utilities / ST201MusicDrivers Folder / Music Drivers / PSyn.h < prev    next >
Text File  |  1993-12-19  |  5KB  |  128 lines

  1.  
  2. /* Include file for 'PSyn', "Polyphonic Channels" */
  3.  
  4. /* Copyright © 1991-1993 by Frank Seide, Hamburg */
  5.  
  6. #ifndef __PCHANNEL__
  7. #define __PCHANNEL__
  8.  
  9. #ifndef __SOUND__
  10. #include "sound.h"
  11. #endif
  12.  
  13. #define STEREO_POSITIONS 64    /* Soviele Stereopositionen möglich */
  14.  
  15. #define STEREO_LEFT 0            /* Linker Kanal, Faktor 2 */
  16. #define STEREO_RIGHT 2            /* Rechter Kanal, Faktor 2 */
  17. #define STEREO_CENTER 4            /* Mitte, jeweils Faktor 1 */
  18. #define STEREO_SURROUND 6        /* Diffus, jeweils Faktor 1 */
  19. #define STEREO_OTHER 8            /* Sonstige Position, Summe der Faktoren ist 2 */
  20.  
  21. /* Polyphonic Channel: Description of the polyphonic sound channel. */
  22.  
  23. typedef struct PChannel {
  24.  
  25.     /* Interfacing to the song interpreting routine: */
  26.  
  27.     long resLong1;            /* $00 */
  28.     void (*userInit)();        /* $04: (Re-)Init the song interpretation */
  29.     int (*userPlay) (struct SoundTrack * soundTrack);    /* $08: IRQ: go ahead one step */
  30.     void (*userCompletion)(); /* $0c: IRQ: last buffer has been played */
  31.     long resLong2;            /* $10 */
  32.     void * userData;        /* $14: Pointer to data private to the interpreting routine */
  33.  
  34.     /* Flags: */
  35.  
  36.     Boolean playing;        /* $18: Still playing ? (RO) */
  37.     Boolean antiAlias;        /* $19: Apply anti-aliasing filter (in real-time) ? (R/W) */
  38.     Boolean stereo;        /* $1a: Stereo ? (RO; use StereoPChannel() to change) */
  39.     Boolean userMixing;    /* $1b: Use Mixing Console ? (R/W) */
  40.     Boolean noSurround;    /* $1c: Suppress generation of surround sound (R/W) */
  41.     Boolean fadeOut;        /* $1d: Set to TRUE to trigger fade out and stop (WO) */
  42.     
  43.     Boolean realTime;        /* $1e: Real-time computation on sound IRQ level 2 ? (R/W) */
  44.     Byte cycleLimit;        /* $1f */
  45.     
  46.     /* Sampling rates: */
  47.     
  48.     Fixed pitchFactor;        /* $20: Fine tuning of the pitch (0.5…2.0) (R/W) */
  49.     Fixed hardFreq;            /* $24: Output sampling freq. (used only by StartpCh.()) */
  50.     long unused2b;            /* $28 */
  51.     
  52.     /* Volume, clipping: */
  53.     
  54.     Fixed mainVolume;        /* $2c: Total volume (R/W) */
  55.     int clipped;                /* $30: Number of samples that had to be clipped (RO) */
  56.     
  57.     /* More flags: */
  58.     
  59.     Boolean muting;        /* $32: Muting (TRUE => silence, computation goes on, R/W) */
  60.     Boolean calcPower;    /* $33: Compute channel sig. power (Set by user, clr'd by IRQ) */
  61.     Boolean userInited;    /* $34 */
  62.     
  63.     /* Support for real-time displays (e. g. oscilloscope): */
  64.     
  65.     Boolean ossiBufEmpty;    /* $35: ossiBuffer is empty (Set by user, clr'd by  IRQ) */
  66.     int ossiBufSize;        /* $36: Size of ossiBuffer (0, if none) */
  67.     Byte * ossiBuffer;        /* $38: Pointer to ossiBuffers (NULL, if none) */
  68.     long unused4;            /* $3c */
  69.  
  70.     /* More private variables following here. */    
  71.     /*** Do not access variables beyond this line. They are subject to change! ***/
  72.  
  73. } PChannel, *PChannelPtr;
  74.  
  75. #define pr_userInit 0x04
  76. #define pr_userPlay 0x08
  77. #define pr_userCompletion 0x0c
  78. #define pr_userData 0x14
  79. #define pr_playing 0x18
  80. #define pr_antiAlias 0x19
  81. #define pr_stereo 0x1a
  82. #define pr_userMixing 0x1b
  83. #define pr_noSurround 0x1c
  84. #define pr_fadeOut 0x1d
  85. #define pr_realTime 0x1e
  86. #define pr_cycleLimit 0x1f
  87. #define pr_pitchFactor 0x20
  88. #define pr_hardFreq 0x24
  89. #define pr_mainVolume 0x2c
  90. #define pr_clipped 0x30
  91. #define pr_muting 0x32
  92. #define pr_calcPower 0x33
  93. #define pr_userInited 0x34
  94. #define pr_ossiBufEmpty 0x35
  95. #define pr_ossiBufSize 0x36
  96. #define pr_ossiBuffer 0x38
  97.  
  98. /* OpenPChannel() flags: */
  99. #define opc_stereo 0x01            /* Open stereo channel */
  100. #define opc_antiAlias 0x02        /* Apply anti-aliasing filter */
  101. #define opc_perfect 0x04            /* Use real low pass filter instead of simple */
  102.                                     /* linear interpolation. */
  103.                                     /* The low pass is designed to suppress aliasing */
  104.                                     /* spectra below quantization error. Therefore */
  105.                                     /* at 16 bit a much longer low pass is used */
  106.                                     /* than at 8 bit. */
  107.                                     /* The perfect filtering requires much more CPU */
  108.                                     /* time. */
  109. #define opc_16Bit 0x40            /* Open 16 bit channel */
  110. #define opc_quiet 0x80            /* Open channel without SndChannel */
  111.  
  112. /* Function prototypes: */
  113.  
  114. extern pascal Boolean CheckPChannel (struct PChannel * pc);
  115. extern pascal void StopPChannel (struct PChannel * pc, Boolean fadeOut);
  116. extern pascal void ClosePChannel (struct PChannel * pc);
  117. extern pascal void ResetPChannel (struct PChannel * pc);
  118. extern pascal OSErr OpenPChannel (int channels, Byte flags, int playFrames, struct PChannel ** pcp);
  119. extern pascal OSErr StartPChannel (struct PChannel * pc);
  120. extern pascal OSErr StereoPChannel (register struct PChannel * pc, Boolean stereo);
  121. extern pascal void PChannelVolume (struct PChannel * pc, int chan, Fixed volume);
  122. extern pascal int PChannelVersion();
  123. extern pascal void PChannelPosition (struct PChannel * pc, int chan, int stereoPosition);
  124. extern pascal unsigned int GetPChannelSignalPower (struct PChannel * pc, unsigned int chan);
  125. extern pascal long ReadPChannel (PChannelPtr pc, unsigned long bufBytes, void * buf);
  126. extern pascal void PChannelCopyright (StringPtr s);
  127.  
  128. #endif __PCHANNEL__